﻿using System;
using System.IO;

namespace FlickrWP7.Core
{
    public static class ByteConverter
    {
        public static byte[] ConvertToByte(Stream source)
        {
            MemoryStream memStream = new MemoryStream();
            byte[] buffer = new byte[1024];
            int bytes;

            while ((bytes = source.Read(buffer, 0, buffer.Length)) > 0)
            {
                memStream.Write(buffer, 0, buffer.Length);
            }

            return memStream.ToArray();
        }
    }
}
